import {PagePlugin} from "@/pagePlugin/type";
import router, {Layouts} from "@/router";

let piniaAll = import.meta.glob("/src/store/modules/*.ts", {eager: true})
export const pagePlugin: PagePlugin = {
  plugins: [],
  stores: {},
  // 注入路由
  router: router,
  pageLayout: Layouts
}

// 注入系统仓库
Object.keys(piniaAll).forEach(key => {
  let newKey = key.replace('/src/store/modules/', '').replace('.ts', '')
  // @ts-ignore
  pagePlugin.stores[newKey] = piniaAll[key]
})

window.__pagePlugin__ = pagePlugin











